# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=golang-gopkg-check.v1
pkgver=0.0.20190902
_commit=41f04d3bba152ddec2103e299fed053415705330
pkgrel=2
pkgdesc='Rich testing for the Go language'
arch=('any')
url="https://github.com/go-check/check/tree/v1"
license=('BSD')
depends=('go' 'golang-github-kr-pretty')
source=("$pkgname-$_commit.tar.gz::https://github.com/go-check/check/archive/$_commit.tar.gz")
sha512sums=('c9fcbb5d90b306e6e938d80107e562e59e91d4d56c4cadfaa19ac39f9780c845206165fcf545549078365a8cb755c65e76002c2c225939bf59e978d7b2fea54d')

check() {
  export GOPATH="$srcdir/build:/usr/share/gocode"
  mkdir -p "$srcdir"/build/src/gopkg.in
  cp -a "$srcdir"/check-$_commit "$srcdir"/build/src/gopkg.in/check.v1
  cd "$srcdir"/build/src/gopkg.in/check.v1
  go test -v $(go list ./...)
}

package() {
  mkdir -p "$pkgdir"/usr/share/gocode/src/gopkg.in
  cp -a "$srcdir"/check-$_commit "$pkgdir"/usr/share/gocode/src/gopkg.in/check.v1

  install -Dm644 check-$_commit/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
